## -*- mode: Awk; -*-  vim: set filetype=awk : 
##
## This file is part of KNIT; copyright (C) 2010 by Tim Menzies
## tim@menzies.us.
##
## KNIT is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.
##
## KNIT is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with KNIT.  If not, see <http://www.gnu.org/licenses/>.

#deShell

#Prune characters that cause shell exection. Useful for avoiding side-effects
#from strings from malicious users.

#Example
#=======

#(KNIT programmers can exercise this example using _cd quill; make eg15_.)

#Input...

#  S="Tim `rm -rf $$HOME/*` Menzies"
#  print S " ==> " deShell(S)

#Output...

#  Tim `rm -rf $HOME/*` Menzies ==> Tim rm -rf HOME/* Menzies

#Code
#====

 function deShell(str) {
     gsub(/["`\$;\|&><]/,"",str);
     return str
 }

#Author
#======

#Tim Menzies

